import {t, api, message, bs} from "@/service/index.js"


export default {
    url: {
        find: "/user/find",
        edit: "/user/edit",
        del: "/user/del",
        updatePassword: "/user/updatePassword",
        info: '/user/info',
        updateInfo: '/user/updateInfo'
    },
    find(data) {
        return api.post(this.url.find,data);
    },
    edit(data){
        const d = Object.assign({},data)
        delete d.rules
        const bol = api.post(this.url.edit,d).then(res => {
            message.success(t("btn.success"))
            return true
        }).catch(e => {
            return false
        })
        return bol
    },
    del(data){
        return api.post(this.url.del,data).then(res => {
            message.success(t("btn.success"))
            return true
        }).catch(e => {
            return false
        })
    },
    updatePassword(data){
        return api.post(this.url.updatePassword,data).then(res => {
            message.success(t("btn.success"))
            return true
        }).catch(e => {
            return false
        })
    },
    info(){
        return api.post(this.url.info,{})
    },
    updateInfo(data){
        return api.post(this.url.updateInfo,data).then(res => {
            message.success(t("btn.success"))
            return true
        }).catch(e => {
            return false
        })
    }
}